using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Events;

namespace Elvex
{
    public class MessageBoxModel : MonoBehaviour
    {
        public string Title { get; private set; }

        public string Context { get; private set; }

        public MessageBoxButtonData[] Buttons { get; private set; }

        private System.Action<int> m_action;

        internal void SetData(string title, string text, MessageBoxButtonData[] buttons, System.Action<int> action)
        {
            Title = title;
            Context = text;
            Buttons = buttons;
            m_action = action;
        }

        public void Click(int btn)
        {
            if (null != m_action)
            {
                m_action(btn);
            }
            DestroyImmediate(gameObject);
        }
    }
}

